package com.eunion.web.cms.entity;

import java.io.Serializable;
import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Size;

/**
 * 专业分类
 */
@Entity
@Table(name = "major_type")
public class MajorType implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 专业类型代号
     */
    @Size(max = 4)
    @Column(name = "major_type_code", length = 4)
    private String majorTypeCode;

    /**
     * 专业类型名称
     */
    @Size(max = 36)
    @Column(name = "major_type_name", length = 36)
    private String majorTypeName;

    /**
     * 上级类型代号
     */
    @Size(max = 4)
    @Column(name = "parent_code", length = 4)
    private String parentCode;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMajorTypeCode() {
        return majorTypeCode;
    }

    public MajorType majorTypeCode(String majorTypeCode) {
        this.majorTypeCode = majorTypeCode;
        return this;
    }

    public void setMajorTypeCode(String majorTypeCode) {
        this.majorTypeCode = majorTypeCode;
    }

    public String getMajorTypeName() {
        return majorTypeName;
    }

    public MajorType majorTypeName(String majorTypeName) {
        this.majorTypeName = majorTypeName;
        return this;
    }

    public void setMajorTypeName(String majorTypeName) {
        this.majorTypeName = majorTypeName;
    }

    public String getParentCode() {
        return parentCode;
    }

    public MajorType parentCode(String parentCode) {
        this.parentCode = parentCode;
        return this;
    }

    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MajorType majorType = (MajorType) o;
        if (majorType.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), majorType.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "MajorType{" +
            "id=" + getId() +
            ", majorTypeCode='" + getMajorTypeCode() + "'" +
            ", majorTypeName='" + getMajorTypeName() + "'" +
            ", parentCode='" + getParentCode() + "'" +
            "}";
    }
}
